import { remove } from '../common'
export default class Dep {
    constructor () {
        this.subs = []
    }
    notify(){
        for(let sub of this.subs) {
            sub.update()
        }
    }
    addSub(sub){
        this.subs.push(sub)
    }
    removeSub(sub){
        remove(this.subs, sub)
    }
    depend(){
        if (window.target){
            this.addSub(window.target)
        }
    }
}